package com.content.management.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.content.management.dao.BusPublishContentDao;
import com.content.management.domain.dto.SummaryByClassificationDto;
import com.content.management.domain.entity.BusPublishContent;
import com.content.management.service.BusPublishContentService;
import com.google.common.collect.Lists;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 发布内容 服务实现类
 * </p>
 *
 * @author xinghu
 * @since 2020-04-04
 */
@Service
public class BusPublishContentServiceImpl extends ServiceImpl<BusPublishContentDao, BusPublishContent> implements BusPublishContentService {

	@Override
	public List<SummaryByClassificationDto> summaryByClassification(List<String> classificationLis) {
		if (CollectionUtils.isNotEmpty(classificationLis)){
			LambdaQueryWrapper<BusPublishContent> wrapper = Wrappers.<BusPublishContent>lambdaQuery().in(BusPublishContent::getClassification, classificationLis);
			return this.baseMapper.summaryByClassification(wrapper);
		}else {
		return 	Lists.newArrayList();
		}
	}
}
